#
# AS++ - C++ Application server extension
#
PROJECT(CAS_ASXMLRPCStub)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)

# ################################################################################
# Macroses
#

# Standard CMake macroses
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckCXXSourceCompiles)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckLibraryExists)

# User-defined macroses
INCLUDE(cmake/RenameModule.cmake)
INCLUDE(cmake/ConfigurePackage.cmake)
INCLUDE(cmake/ConfigureLibrary.cmake)

# ################################################################################
# Set system-specific data
#
MESSAGE(STATUS "#### System name is: ${CMAKE_SYSTEM_NAME}")

#
# Configure CTPP2 package
#
CONFIGURE_PACKAGE(ctpp2-config ctpp2 CTPP2)

#
# Configure CAS package
#
CONFIGURE_PACKAGE(cas-config cas CAS)

# ################################################################################
# Setup libraries & headers
#

INCLUDE_DIRECTORIES(include)

# ################################################################################
# Lib binary
#
SET(MODULE_NAME "mod_xmlrpcstub")

ADD_LIBRARY(${MODULE_NAME} MODULE src/ASXMLRPCStub.cpp)
TARGET_LINK_LIBRARIES(${MODULE_NAME} ${HAVE_ctpp2} ${HAVE_cas})
RENAME_MODULE(${MODULE_NAME} ${MODULE_NAME})

# ################################################################################
# Install modules
#
INSTALL(FILES ${MODULE_NAME}.so
        DESTINATION libexec/cas
        PERMISSIONS OWNER_READ OWNER_WRITE
                    GROUP_READ
                    WORLD_READ)

# End.
